<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
  <head>
  <!-- 这个页面中不要包含有js!!! -->
  <%@ include file="/pages/common/common.jsp" %>	
  
  <script type="text/javascript">
		//写注册验证
		
		$(function(){
		$("#password2").blur(function(){
			if($(this).val()==$("#password1").val()){
			document.getElementById("passwordfail").style.display="none";
			} else {
			document.getElementById("passwordfail").style.display="";
			}
		})	
	})
	
	
	/** 修改密码 */
	function updatePassword(){
		var r = $('#pwdForm').form('validate'); 
		if(!r) {
			return false;
		}
		var url="${ctx}/admin/admin/updatePassword.adm";
		
		$.post(url,$("#pwdForm").serializeArray(),function(data){
			if(data.success){//操作成功
				$.messager.alert('提示','操作成功','info');
				$('#pwdForm').form('clear');
			}else{
				$.messager.alert('提示',data.msg,'warning');	
			}
		});
	}
	/** 修改密码 */
	function resetPassword(){
	var url="${ctx}/admin/admin/resetPassword.adm";
		
		$.post(url,$("#pwdForm").serializeArray(),function(data){
			if(data.success){//操作成功
				$.messager.alert('提示','操作成功','info');
				$('#pwdForm').form('clear');
			}else{
				$.messager.alert('提示',data.msg,'warning');	
			}
		});
	}
/** 清空查询条件 */
	function clearForm(){
		$('#pwdForm').form('clear');
		//searchUser();
	}
	</script>
  </head> 
  
  <body>
  <div style="text-align:center"> 
  	<!-- 验证还是jquery-validation好用，这里省事没用 -->
	<form class="auform" id="pwdForm" method="post">
  <div id="upt_div" style="margin: 5px;width: 730px;">
  	<h2>密码修改</h2>
	<div class="info_div">
		<div class="info_content">
			<table align="center">
				<tr>
				<td class="autd1">原密码：</td>
				<td class="autd2"><input name="password" id="password" type="password" style="width:150px" validType="length[6,30]" class="easyui-validatebox txt" required="true"><span class="red">*</span></td>
				
				</tr><tr><td class="autd1">新密码 :</td>
				<td class="autd2"><input name="password1" id="password1" type="password" style="width:150px" validType="length[6,30]" class="easyui-validatebox txt" required="true"><span class="red">*</span></td>
				</tr>
				<tr>
				<td class="autd1">重复密码：</td>
				<td class="autd2"><input name="password2" id="password2"  type="password" style="width:150px" validType="length[6,30]" class="easyui-validatebox txt" required="true"><span class="red">*</span>
				
				</td>
				
				</tr>
				<tr>
				<td>&nbsp;</td>
				<td><span style=display:none id="passwordfail"><font color="red">两次输入密码不一致</font></span></td></tr>
			</table>
		</div>
	</div>
	
	<div class="btn_div">
		<a href="#" id="btn-add"
							onclick="clearForm();"
							class="easyui-linkbutton" iconCls="icon-cancel">重填</a>&nbsp;
		<a href="#" id="btn-add"
							onclick="updatePassword();"
							class="easyui-linkbutton" iconCls="icon-save">修改密码</a>
	</div>
</div>
</form>
</div>
  </body>
</html>
